﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CnGine.CodeGenerator.Help
{
    public class CommHelper
    {

        /// <summary>
        /// 获取当前程序集路径
        /// </summary>
        /// <returns></returns>
        public static string GetAssemblyPath()
        {

            //System.IO.Directory.GetCurrentDirectory

            string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
            codeBase = codeBase.Substring(8, codeBase.Length - 8);
            string[] arrSection = codeBase.Split(new char[] { '/' });
            string folderPath = "";
            for (int i = 0; i < arrSection.Length - 1; i++)
            {
                folderPath += arrSection[i] + "/";
            }
            return folderPath;
        }
    }
}
